package day02;

public class DataTypeCastDemo {
    public static void main(String[] args) {
        /*
        int a = 5;
        long b = a;//自动类型转换
        int c = (int)b;//强制类型转换

        long d = 5;//自动类型转换
        double e = 5;//自动类型转换
        System.out.println(e);//5.0默认保留一位小数

        long f = 10000000000L;
        int g = (int)f;
        System.out.println(g);//强转有可能发生溢出
        double h = 23.234;
        int i = (int)h;
        System.out.println(i);//25.强转可能会丢失精度


        int aa = 211;
        long bb = aa;
        int cc = (int)bb;

        long dd = 54;
        double ee = 56;
        System.out.println(ee);
        long ff = 10000000000L;
        int gg = (int)ff;
        System.out.println(gg);
        double hh = 34.2334;
        int ii = (int)hh;
        System.out.println(ii);
        */
        //两点规则
        byte b1 = 5;
        byte b2 = 6;
        byte b3 = (byte)(b1+b2);

        System.out.println(2+2);
        System.out.println(2+'2');
        System.out.println('2'+'2');
        System.out.println('2');

        int m = 'a';
        System.out.println(m);//97.查看字符对应的码

        char n = 97;
        System.out.println(n);//a.查看码对应的字符

        byte b11 = 55;
        byte b12 = 65;
        byte b13 = (byte)(b11+b12);
        System.out.println(b13);

        System.out.println(4+6);
        System.out.println(2+'a');
        System.out.println('a'+'A');
        System.out.println('a');
        int m1 = 'a';
        System.out.println(m1);
        char n1 = 65;
        System.out.println(n1);

    }
}
